<%-- 
    Document   : history
    Created on : May 1, 2013, 3:50:18 PM
    Author     : Vitaliy Mostipaka <imprtat@gmail.com>
--%>

<%@page import="java.util.List"%>
<%@page import="com.charlie.db.ShipmentOrderData"%>
<%@include file="/header.jsp"%>

<div class="left_side">
    <jsp:include page="/blocks/conditionalLeftBar.jsp" />
</div>

<div class="right_side">
    <h2 class="content_title">View orders</h2>
    <div class="white_block">
        <h2>Order history</h2>
        <table class="typycal_table">
            <thead>
                <tr>
                    <th>Creation date</th>
                    <th>Tracking number</th>
                    <th>Delivery location</th>
                    <th>Cost</th>
                    <th>Status</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <%
                List<ShipmentOrderData> orders = (List<ShipmentOrderData>) request.getAttribute("list");
                if (orders != null) {
                    for (ShipmentOrderData order : orders) {
                %>
                <tr>
                    <td><%= order.getCreationDate() %></td>
                    <td><%= order.getSoId() %></td>
                    <td><%= order.getLocation() %></td>
                    <td><%= order.getCost() + order.getShipingCost() %>$</td>
                    <td><%= order.getStatus() == null ? "Entering" : order.getStatus()  %></td>
                    <td><a href="${pageContext.request.contextPath}/track/<%= order.getSoId() %>">View</a></td>
                </tr>
                <%
                    }
                }%>
            </tbody>
        </table>
    </div>
    <jsp:include page="/blocks/pages.jsp">
        <jsp:param name="path" value="history" />
    </jsp:include>
</div>

<jsp:include page="/footer.jsp" />
